module.exports = {
  'add device': function (browser) {
    const devServer = browser.globals.devServerURL
    console.log(devServer)

    browser
      .url("http://localhost:8081/#/DeviceConfig")
      .waitForElementVisible('#buttonAddDevice', 2000)
      .click("button")
      .waitForElementVisible('#buttonSaveDevice', 2000)
      .assert.cssClassPresent('#buttonSaveDevice',"is-disabled")
      .setValue('input[placeholder="类型名称"]',"压力仪器")
      .setValue('input[placeholder="数据包的正则表达式"]',"\\{\\d+\\}")
      .setValue('input[placeholder="数据项的正则表达式"]',"\\{(\\d+)\\}")
      .setValue('textarea[placeholder="示例内容"]',"{222}")
      .useXpath()
      .click("//*[contains(text(),'检测表达式')]")
      .waitForElementVisible("//*[contains(text(),'数据-1')]", 2000)
      .useCss()
      .assert.cssClassNotPresent('#buttonSaveDevice',"is-disabled")
      .clearValue('input[placeholder="数据包的正则表达式"]')
      .setValue('input[placeholder="数据包的正则表达式"]',"\\{\\d+\\}")
      .clearValue('input[placeholder="数据项的正则表达式"]')
      .setValue('input[placeholder="数据项的正则表达式"]',"\\{(\\d+)\\}")
      .assert.cssClassPresent('#buttonSaveDevice',"is-disabled")
      .useXpath()
      .click("//*[contains(text(),'检测表达式')]")
      .pause(1000)
      .useCss()
      .assert.cssClassNotPresent('#buttonSaveDevice',"is-disabled")
      .setValue('input[placeholder="数据项名称"]',"压力")
      .click('#buttonSaveDevice')
      .pause(1000)
      .end();

  }
}